gboolean has_border;
gboolean has_border_radius;
gboolean has_inset_box_shadow;
+ gboolean has_large_corners;
StShadow *box_shadow_spec;
StShadow *background_image_shadow_spec;
const char *background_image;
else
has_border_radius = FALSE;
+ /* The cogl code pads each corner to the maximum border radius,
+ * which results in overlapping corner areas if the radius
+ * exceeds the actor's halfsize, causing rendering errors.
+ * Fall back to cairo in these cases. */
+ has_large_corners = FALSE;
+
+ if (has_border_radius) {
+ guint border_radius[4];
+ int corner;
+
+ st_theme_node_reduce_border_radius (node, border_radius);
+
+ for (corner = 0; corner < 4; corner ++) {
+ if (border_radius[corner] * 2 > height ||
+ border_radius[corner] * 2 > width) {
+ has_large_corners = TRUE;
+ break;
+ }
+ }
+ }
+
/* Load referenced images from disk and draw anything we need with cairo now */
background_image = st_theme_node_get_background_image (node);
border_image = st_theme_node_get_border_image (node);
/* Use cairo to prerender the node if there is a gradient, or
* background image with borders and/or rounded corners,
- * since we can't do those things easily with cogl.
+ * or large corners, since we can't do those things
+ * easily with cogl.
*
* FIXME: if we could figure out ahead of time that a
* background image won't overlap with the node borders,
*/
if ((node->background_gradient_type != ST_GRADIENT_NONE)
|| (has_inset_box_shadow && (has_border || node->background_color.alpha > 0))
- || (background_image && (has_border || has_border_radius)))
+ || (background_image && (has_border || has_border_radius))
+ || has_large_corners)
node->prerendered_texture = st_theme_node_prerender_background (node);
if (node->prerendered_texture)